package br.com.atibrasil.fx.aplication;

import java.io.IOException;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
//import br.com.gensystems.businessobject.FuncionarioBusinessObject;
//import br.com.gensystems.model.Funcionario;
 
public class GUILogin extends Application {
    public static Stage stage = null;	
//    public static Funcionario usuarioLogado;
//    private static FuncionarioBusinessObject funcionarioBO = new FuncionarioBusinessObject();
    
	@Override	
	public void start(Stage stage) throws Exception {
		execute();
	}
	
	public static void main(String[] args) {
		launch(null);
	}
	
	public static void execute(){
		Parent root;		
		try {
			root = FXMLLoader.load(GUIController.class.getResource("/br/com/atibrasil/fx/fxml/loginForm.fxml"));	
		} catch (IOException e) {
			e.printStackTrace();
			return;
		}		
		Scene scene = new Scene(root);
		
		Stage stage = new Stage();
		GUILogin.stage = stage;				
		stage.setScene(scene);	
		stage.setResizable(false);
		stage.initModality(Modality.APPLICATION_MODAL);
		stage.sizeToScene();	
		stage.initStyle(StageStyle.TRANSPARENT);
		stage.show();				
	}

	public static void close(){
//		usuarioLogado = funcionarioBO.find(usuarioLogado.getId());
		stage.close();

		GUIController.execute(GUISplash.NOME_APLICACAO);
	}	
	public static void cancel(){
		stage.close();
		GUIController.close();
	}	
}
